package agenda.database.entities;

import java.util.Date;

import agenda.extra.Utils;

/**
 * @author sPeC!
 * 
 */
public class Evento
{
	public static final String[] TYPES = {"FESTIVIDADE", "EXAME", "OUTRO"};
	
	public static final int FESTIVIDADE = 0;
	public static final int EXAME = 1;
	public static final int OUTRO = 2;
	
	private long id;
	private int type;
	private String title;
	private Date startDate;
	private Date endDate;
	private String description;

	public long getId()
	{
		return id;
	}

	public int getType()
	{
		return type;
	}

	public String getTitle()
	{
		return title;
	}

	public Date getStartDate()
	{
		return startDate;
	}

	public Date getEndDate()
	{
		return endDate;
	}

	public String getDescription()
	{
		return description;
	}

	public Evento(long id, int type, String title, String startDate, String endDate, String description)
	{
		this.id = id;
		this.type = type;
		this.title = title;
		this.startDate = Utils.stringToDateTime(startDate);
		this.endDate = Utils.stringToDateTime(endDate);
		this.description = description;
	}

	public boolean overlaps(String startDate, String endDate)
	{
		Date start = Utils.stringToDateTime(startDate);
		Date end = Utils.stringToDateTime(endDate);

		return start.compareTo(this.endDate) <= 0 && this.startDate.compareTo(end) <= 0;

	}
}